function logout1() {
	var a = getRootPath()
	var b = "../logout"
	$.ajax({
		url : b,
		type : "post",
		success : function(res) {
			console.log(res)
			if (res.status == 200) {
				delCookie("user")
				window.location.href = a;
			}
		},
		error : function(e) {
			console.log(e)
		}
	})
}
function logout() {
	var a = getRootPath()
	var b = a+"/logout"
	$.ajax({
		url : b,
		type : "post",
		success : function(res) {
			console.log(res)
			if (res.status == 200) {
				delCookie("user")
				window.location.href = a;
			}
		},
		error : function(e) {
			console.log(e)
		}
	})
}

function getRootPath(){
	//获取当前网址，如： http://localhost:8083/uimcardprj/share/meun.jsp
	var curWwwPath=window.document.location.href;
	//获取主机地址之后的目录，如： /uimcardprj/share/meun.jsp
	var pathName=window.document.location.pathname;
	//获取带"/"的项目名，如：/uimcardprj
	var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
	return(projectName);
}

function delCookie(name) {
	var exp = new Date();
	exp.setTime(exp.getTime() - 1);
	var cval = getCookie(name);
	if (cval != null) {
		document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
	}
}

function getCookie(name) {
	var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
	if (arr = document.cookie.match(reg)) {
		return (arr[2]);
	} else {
		return null;
	}
}